{layout name="layout" /}
<div id="actionbar" class="fn-clear">
    <button class="button button-blue openwin" url="{:url('group/add')}"><i class="iconfont icon-list_icon"></i>选择商品</button>
</div>
<table class="table table-border">
    <thead>
        <tr>
            <th class="fn-tac w100">操作</th>
            <th class="fn-tac w100">￥团购价</th>  
            <th class="fn-tac w100">几人团</th>          
            <th class="fn-tac w80">商品名称</th>
            <th></th>
            <th class="w100 fn-tar">￥销售价</th>
        </tr>
    </thead>
    <tbody>
        {foreach $lists as $vo}<tr>
            <td class="fn-tac">
                <a class="button isDel" url="{:url('group/delete',['id'=>$vo.id])}"href="javascript:;" title="删除">
                    <i class="iconfont icon-lajixiang"></i>删除
                </a>
            </td>
            <td class="fn-tac"><input name="sort" class="w80 input fn-tac" type="text" value="{$vo.amount}" id="{$vo.id}" /></td> 
            <td class="fn-tac"><input name="hao_people" class="w80 input fn-tac" type="text" value="{$vo.hao_people}" id="{$vo.id}" /></td>           
            <td class="fn-tac"><img src="{$vo.item.img}?x-oss-process=style/80" class="w60" /></td>
            <td>{$vo.item.name}</td>
            <td class="fn-tar">￥{$vo.item.sell_price}</td>
        </tr>
        {/foreach}
    </tbody>
</table>
{$lists|raw}
<script type="text/javascript">
    Do('base', 'layer', function () {
        $('.isDel').isDel();
        sort("{:url('group/amount')}");
        //修改价格
        $("input[name='hao_people']").change(function () {
            var id = $(this).attr('id');
            var value = $(this).val();
            var url = "{:url('group/hao_people')}";
            $.post(url, { id: id, sort: value }, function (data) {
                if (data.code == 200) {
                    layer.msg(data.msg, { time: 300 }, function () { window.location.reload(); });
                } else {
                    layer.msg(data.msg);
                }
            })
        });
        $(".openwin").click(function () {
            var url = $(this).attr('url');
            var index = parent.layer.getFrameIndex(window.name);
            parent.layer.open({
                type: 2, maxmin: false, area: ['60%', '70%'], content: url, end: function () {
                    window.location.reload()
                }
            });
        });
    })
</script>